import Axios, { downLoadFile } from '@/utils/request';

/**
 * 获取用户面板
 */
export function getUserPanel(): Promise<any> {
    return Axios.get('/entry/subscribe/all/panel/user');
}

/**
 * 根据面板查询模块
 */
export function getModuleByPanelCode(code): Promise<any> {
    return Axios.get('/entry/subscribe/modules/' + code);
}

/**
 * 查询条目的总体结果
 */
export function getEntryResult(data): Promise<any> {
    return Axios.post('/panorama/query', data);
}

/**
 * 根据模块编号查询条目
 */
export function getModuleEnableEntry(isEnable, moduleCode): Promise<any> {
    return Axios.get(isEnable ? '/entry/subscribe/enableEntrys/' + moduleCode : '/entry/subscribe/entrys/' + moduleCode);
}

/**
 * 获取条目明细信息
 */
export function getEntryResultDetail(data): Promise<any> {
    return Axios.post('/panorama/query/entry', data);
}

/**
 * 风险全景图查询条目明细信息
 */
export function monitorDetailColumnCache(data): Promise<any> {
    return Axios.post('/dataMonitor/monitorDetailColumnCache', data);
}

/**
 * 查询用户习惯
 */
export function getModuleHabit(): Promise<any> {
    return Axios.get('/panorama/module/habit');
}

/**
 * 根据模块手动启动
 */
export function manualStartByModuleCode(moduleCode): Promise<any> {
    return Axios.get(`/panorama/module/manualStart/${moduleCode}`);
}

/**
 * 更新或者插入用户习惯(thresholdTypes)
 */
export function updateModuleHabit(data: any): Promise<any> {
    return Axios.post('/panorama/module/update/habit', {
        accurateSelect: true,
        brandResultId: '',
        entryCode: '',
        entryCodeSql: '',
        entryCodes: [],
        entryName: '',
        fundCodes: [],
        fundGrCodes: [],
        handleStatus: '',
        moduleCode: '',
        moduleCodes: [],
        originalAccountId: '',
        paging: {
            currentPage: 0,
            pageSize: 0,
        },
        resultIds: [],
        resultType: '',
        sort: '',
        thresholdTypes: data,
        useEntryPanelCode: '',
    });
}

/**
 * 查询监控屏模块重新计算进度
 */
export function rateOfProgress(moduleCode): Promise<any> {
    return Axios.get(`/panorama/module/isRefreshComplete/${moduleCode}`);
}
